Set up an agreement

The setup agreement step validates the cardholder details and stores securely the credentials on file, so that they can be used in subsequent transactions many times without a need to be reintroduced by the customer.

The diagram below describes a typical setup agreement flow using the Merchant API.

You can set up an agreement using one of the following methods:

  • /createPaymentRequest
  • Along with the other mandatory parameters described in the createPaymentRequest page, when set up the agreement using createPaymentRequest API method, you should specify the type parameter. See below the possible values.

      curl --request POST \
      --url https://<YourShopName>.altapaysecure.com/merchant/API/createPaymentRequest \
      --header 'Authorization: Basic auth' \
      --data type=subscription \
      --data `agreement[type]`=recurring \
      --data 'terminal=Pensio Terminal' \
      --data shop_orderid=abc123 \
      --data amount=50 \
      --data currency=EUR \
                                                            
  • /setupSubscription
  • Use the setupSubscription method as a shortcut for calling the reservation method with typesubscription for payments using the full credit card details.

    The method has the exact same parameter specification as reservation, but the type parameter is always set to subscription, even if you specify a different type in the method call.

      curl --request POST \
      --url https://<YourShopName>.altapaysecure.com/merchant/API/setupSubscription \
      --header 'Authorization: Basic auth' \
      --data type=subscription \
      --data `agreement[type]`=unscheduled \
      --data 'terminal=Pensio Terminal' \
      --data shop_orderid=abc123 \
      --data amount=50 \
      --data currency=EUR \
      --data cardnum=4111111111111111 \
      --data emonth=08 \
      --data eyear=2025 \
      --data cvc=123 \
                                                            
  • VerifyCard as Unscheduled Charges
  • It is possible to use the verifyCard to set up unscheduled charges agreement.

    See VerifyCard as Unscheduled Charges for more details.


The following table describes the required parameters when set up an agreement

The following list does not represent the complete list of the parameters used when set up an agreement. For the entire list of the parameters, please check the parameters list of every setup agreement method described above.

Select from the drop-down list to see the parameters relevant for that method/acquirer:

Parameter Description Type Mandatory
type

This is the authorization type.

Below you can find more details about the type parameter and the possible values.

string Yes, excepting the case when setting up the agreement using /setupSubscription method.
agreement[type]

This is the type of the agreement.

Below you can find more details about the agreement[type] parameter and the possible values.

string No. Recurring value will be used in case the parameter is not set.
agreement[unscheduled_type]

This is the type of the unscheduled agreement.

Below you can find more details about the agreement[unscheduled_type] parameter and the possible values.

string Only in case the type is subscriptionAndCharge or subscriptionAndReserve and the agreement[type]=unscheduled.
agreement[expiry]

This is the date when the agreement expires. It must have the format YYYYMMDD.

string No.
agreement[frequency]

It is an integer value representing the frequency between the charge agreement requests made by the merchant. Possible values: 0 - Flexible; 1 - Daily; 7 - Weekly; 14 - Biweekly; 30 - Monthly; 90 - Quarterly; 365 - Yearly.

string No. Default Value: Monthly for recurring/instalment, Flexible for unscheduled. Default Value: Flexible
Not allowed for unscheduled agreement.
agreement[next_charge_date]

This is the date of the first charge agreement request made by the merchant. It must have the format YYYYMMDD..

string No
agreement[admin_url]

This is a link to a page on the merchant side where the customer can manage the agreement.

string NoYes
agreement[retention_period]

The customer will be able to cancel the agreement only after passing this retention period.

string No
customer_info[customer_phone]

This is the customer phone number. Used to improve customer experience.

string Recommended for a good customer experience.
orderLines

The individual line items of the order. This is mandatory for some providers, and recommended for a good customer experience.

See details here

Array NoYes

Subscription type

When setting up a new agreement, you can decide whether to just set up the agreement, or set it up and immediately create a reservation or charge for the created agreement, using the type parameter on the call: 

Payment request type

Description

subscription

The payment is part of an agreement. The agreement is set up, and the payment is authorized immediately, but as a merchant, you have to capture each instalment separately using the captureReservation or chargeSubscription method, or using the Merchant Information Interface.

subscriptionAndCharge

The agreement is set up, and an attempt is made to capture the first instalment payment.

The XML response has two <Transaction> elements. If either the agreement setup or the capture is successful, the <Result> XML response parameter is set to Success, even if the other transaction fails. This means that you cannot rely solely on the <Result> parameter to determine whether the transaction was successful.

subscriptionAndReserve

The agreement is set up, and an attempt is made to reserve the first instalment payment.

Not all acquirers support this. For more information, see Payment methods and providers.

If either the agreement setup, or the reservation is successful, the <Result> XML response parameter is set to Success, even if one of the transactions fail. The XML response has two <Transaction> elements. This means that you cannot rely solely on the <Result> parameter to determine whether the transaction was successful.

Agreement type

When setting up a new agreement, you can decide what kind of agreement you want to create, using the agreement[type] parameter on the call:

Agreement type

Description

recurring

Allows the merchant to charge the customer with a specific frequency and in most cases with a specific amount, in exchange for fixed goods or services.

Default. If no agreement[type] is provided, recurring will be used.

When set up a recurring agreement, the Strong Customer Authentication takes place.

instalment

Allows the merchant to charge the customer for goods or services billed to a cardholder in multiple transactions, over a period of time agreed with the cardholder.

When set up an instalment agreement, the Strong Customer Authentication takes place.

unscheduled

Allows the merchant to charge the customer for goods or services that do not follow a specific frequency, neither have a fixed amount to be paid out.

When only setting up an unscheduled agreement "authType=subscription", you can use 0 as amount in order to avoid charging customer. If you're intending to reserve/charge right away, please use the right amount in the request.

When set up an unscheduled agreement, the Strong Customer Authentication takes place.


Unscheduled type

In case the type parameter is subscriptionAndCharge or subscriptionAndReserve and the agreement[type]=unscheduled, the agreement[unscheduled_type] parameter is mandatory.

Unshceduled type

Description

incremental

An incremental authorisation is typically found in hotel and car rental environments, where the cardholder has agreed to pay for any service incurred during the duration of the contract. A common scenario is additional services charged to the contract, such as extending a stay in a hotel.

For the incremental authorisation, the cardholder authentication is not required.

resubmission

This is an event that occurs when the original purchase occurred but the Merchant was not able to get authorisation at the time the goods or the services were provided.

For the resubmission authorisation, the cardholder authentication is not required.

delayedCharges

A delayed charge is typically used in hotel, cruise lines and vehicle rental environments to perform a supplemental account charge after original services are rendered.

For the delayed charge authorisation, the cardholder authentication is not required.

reauthorisation

A reauthorisation is a purchase made after the original purchase. A common scenario is delayed/split shipments.

For the reauthorisation, the cardholder authentication is not required.

noShow

A no-show is a transaction where the merchant are enabled to charge for services which the cardholder entered into an agreement to purchase, but the cardholder did not meet the terms of the agreement.

For the no-show authorisations, the cardholder authentication is not required.

charge

A transaction using a Stored Credential for a fixed or variable amount that does not occur on a scheduled or regularly occurring transaction date. This includes account top-ups triggered by balance thresholds.

For the charge authorisations, the Strong Customer Authentication takes place.

Response Examples

Please make sure you store the transaction_id in your system.

The transactionId of the setup agreement transaction from the response will be sent as the agreement[id] parameter of the charge agreement request.